package com.java.controller.admin;

import com.java.entity.House;
import com.java.service.HouseService;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

@CrossOrigin
@RestController
@RequestMapping("/api/vue-admin-template/house")
public class AdminHouseController {
    @Autowired
    HouseService houseService;
    //获取审核房屋列表
    @RequestMapping("/findByHaudit")
    public Map<String,Object> findByHaudit(){
        List<House> houses = houseService.selectByHaudit();
        Map<String,Object> map=new HashMap<>();
        map.put("data",houses);
        map.put("code",20000);
        map.put("message","查询数据成功");
        return map;
    }

    //通过审核
    @RequestMapping("/updateHaudit")
    public Map<String,Object> updateHaudit(@Param("houseId") String houseId){
        houseService.updateHaudit(Integer.parseInt(houseId));
        Map<String,Object> map=new HashMap<>();
        map.put("data","");
        map.put("code",20000);
        map.put("message","查询数据成功");
        return map;
    }
}
